package sslf.com.service;

import java.sql.SQLDataException;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.alibaba.druid.pool.vendor.NullExceptionSorter;

import sslf.com.dao.TestDao;
import sslf.com.domain.User;

@Service
public class TestService {
	
	@Autowired
	private TestDao testDao;
	
	public User select(){
		return this.testDao.select();
	}
	
	/** 测试 事务
	 * @return
	 * @Date 2014-11-5下午3:34:14
	 * @作者 cjw
	 */
	@Transactional( rollbackFor={Exception.class})
	public void testTransactional()  throws Exception {
		
		this.testDao.insert();
		//int a = 4/0;
		throw new SQLDataException("Trade Order Insert Failed");
		
	}
}
